RichTextKit v0.4

BinarySearchExtension.BinarySearch<T> Method

Assembly: Topten.RichTextKit.dll
Namespace: Topten.RichTextKit.Utils
Declaring Type: BinarySearchExtension

Overloads

BinarySearch<T>(this IReadOnlyList<T>, T)

Performs a binary search on the entire contents of an IReadOnlyList

BinarySearch<T,U>(this IReadOnlyList<T>, U, Func<T,U,int>)

Performs a binary search on the entire contents of an IReadOnlyList

BinarySearch<T,U>(this IReadOnlyList<T>, int, int, U, Func<T,U,int>)

Performs a binary search on a a subset of an IReadOnlyList

BinarySearch<T>(this IReadOnlyList<T>, T)

Performs a binary search on the entire contents of an IReadOnlyList

public static int BinarySearch<T>(this IReadOnlyList<T> list, T value);

Type Parameters

T

The list element type

Parameters

this IReadOnlyList<T> list

The list to be searched

T value

The value to search for

Returns

int

The index of the found item; otherwise the bitwise complement of the index of the next larger item

BinarySearch<T,U>(this IReadOnlyList<T>, U, Func<T,U,int>)

Performs a binary search on the entire contents of an IReadOnlyList

public static int BinarySearch<T,U>(this IReadOnlyList<T> list, U value, Func<T,U,int> compare);

Type Parameters

T

The list element type

U

The value type being searched for

Parameters

this IReadOnlyList<T> list

The list to be searched

U value

The value to search for

Func<T,U,int> compare

A comparison function

Returns

int

The index of the found item; otherwise the bitwise complement of the index of the next larger item

BinarySearch<T,U>(this IReadOnlyList<T>, int, int, U, Func<T,U,int>)

Performs a binary search on a a subset of an IReadOnlyList

public static int BinarySearch<T,U>(this IReadOnlyList<T> list, int index, int length, U value, Func<T,U,int> compare);

Type Parameters

T

The list element type

U

The value type being searched for

Parameters

this IReadOnlyList<T> list

The list to be searched

int index

The start of the range to be searched

int length

The length of the range to be searched

U value

The value to search for

Func<T,U,int> compare

A comparison function

Returns

int

The index of the found item; otherwise the bitwise complement of the index of the next larger item